function WrapFunction(name) {
    return function() {
        Game[name]();
    };
}
function CreateCommand(key,callName,callNameEnd) { 
	const  command = `On${key}${Date.now()}`;
    Game.CreateCustomKeyBind(key, `+${command}`);
    Game.AddCommand(
        `+${command}`,
			WrapFunction(callName)
        ,
        ``,
        0
    );
    if(callNameEnd!= undefined && callNameEnd != null){
        Game.AddCommand(
            `-${command}`,
                WrapFunction(callNameEnd),
            ``,
            0
        );
    }
}


(function() {
	// CreateCommand("W","PlayerMoveUp");
	// CreateCommand("S","PlayerMoveDown");
	// CreateCommand("A","PlayerMoveLeft");
	// CreateCommand("D","PlayerMoveRight");
	CreateCommand("=","PlayerTest");
    CreateCommand("1","PlayerKey1");
    CreateCommand("2","PlayerKey2");
    CreateCommand("3","PlayerKey3");
    CreateCommand("4","PlayerKey4");
    CreateCommand("5","PlayerKey5");
    CreateCommand("6","PlayerKey6");
    CreateCommand("7","PlayerKey7");
    CreateCommand("8","PlayerKey8");
    CreateCommand("9","PlayerKey9");
    CreateCommand("0","PlayerKey0");

})();

